<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<?php
$operacion = $_POST['lista'];















echo $_POST['c1']." ".$operacion." ".$_POST['c2']." "; 
echo " " ;

switch ($operacion){
	
	case "+":
		$resultat =  $_POST['c1'] + $_POST['c2'];
	echo $_POST['c1'] + $_POST['c2'];
	break;
	
	case "-":
		$resultat =  $_POST['c1'] - $_POST['c2'];
	echo $_POST['c1'] - $_POST['c2'];
		break;
		
	case "*":
		$resultat =  $_POST['c1'] * $_POST['c2'];
		echo $_POST['c1'] * $_POST['c2'];
			break;
			
	case "/":
		$resultat =  $_POST['c1'] / $_POST['c2'];
		echo $_POST['c1'] / $_POST['c2'];
				break;
	
}




if($resultat<0){$resultat=-$resultat;
echo "<p style='color:red'>";

}else{echo "<p>";
};
for($i=0;$i<$resultat;$i++)
	echo "*";
echo "</p>";

?>
<form action="calculadora.php" method="post" name="calculadora">
	<label>Introduce valores:</label><br />
	A:<input type="text" name="c1" />
	B:<input type="text" name="c2" />
	
	
	<br>
		<input type="submit" name="lista" value="+" />
		<input type="submit" name="lista" value="-" />
		<input type="submit" name="lista" value="*" />
		<input type="submit" name="lista" value="/" />
	
	

</form>


</body>
</html>